import { GET_USER_INFO_SUCCESS } from '../consts/index.js';
import createReducer from '../../../utils/createReducer.js';

const initState = {
  userInfo: {},
};

const actionHandlers = {
  [GET_USER_INFO_SUCCESS](state, action) {
    return {
      ...state,
      userInfo: action.result.data
    }
  },
};

// export default function reducer(state = initState, action) {
//   switch (action.type) {
//     case GET_USER_INFO_SUCCESS:
//       return {
//         ...state,
//         userInfo: action.result.data,
//       };
//     default:
//       return state;
//   }
// }

export default createReducer(initState, actionHandlers);